
//
//  HMLoadMoreFooter.m
//  黑马微博-wzy
//
//  Created by Mac on 2017/2/11.
//  Copyright © 2017年 Mac. All rights reserved.
//

#import "HMLoadMoreFooter.h"

@implementation HMLoadMoreFooter


- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self setupView];
    }
    return self;
}


- (void)setupView{

    self.backgroundColor = [UIColor orangeColor];
    //label
    _footerLabel = [[UILabel alloc] initWithFrame:self.bounds];
    _footerLabel.textAlignment = NSTextAlignmentCenter;
    _footerLabel.textColor = [UIColor whiteColor];
    _footerLabel.text = @"上拉可以加载更多数据";
    [self addSubview:_footerLabel];
    
    //右边 图标
    _loadIcon = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray];
    _loadIcon.frame = CGRectMake(kScreenWidth - 40, (50 - 25) / 2, 25, 25);
    [_loadIcon startAnimating];
    [self addSubview:_loadIcon];

}

//开始加载
- (void)beginRefreshing{
    self.footerLabel.text = @"正在拼命加载更多数据...";
    [self.loadIcon startAnimating];
    self.refreshing = YES;
}

//结束加载
- (void)endRefreshing{
    self.footerLabel.text = @"上拉可加载更多数据";
    [self.loadIcon stopAnimating];
    self.refreshing = NO;

}

@end
